#define _GNU_SOURCE
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <net/if.h>
#include <signal.h>
#include <sys/select.h>
#include <net/route.h>
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/route/link.h>
#include <netlink/route/route.h>

int main()
{
	struct nl_cache *cache = NULL;
	struct nl_sock *socket;

	socket = nl_socket_alloc();
	nl_connect(socket, NETLINK_ROUTE);

	if (rtnl_route_alloc_cache(socket, AF_INET, ROUTE_CACHE_CONTENT, &cache) < 0) {
		perror("rtnl_route_alloc_cache");
		exit(0);
	}

	char host[1024];
	//nl_addr2str(addr, host, sizeof(host));
	printf("%s", host);
	return 0;
}
